<template>
    <div class="header-nav">
        <div class="left">
            <span class="text">叩丁狼电商运营平台</span>
            <i class="el-icon-menu"></i>
        </div>
        <div class="right">
            <el-dropdown>
                <span class="el-dropdown-link">
                    admin
                    <el-icon class="el-icon--right">
                        <arrow-down />
                    </el-icon>
                </span>
                <template #dropdown>
                    <el-dropdown-menu>
                        <div @click="gohome">
                            <el-dropdown-item>首页</el-dropdown-item>
                        </div>
                        <div @click="tuichu">
                            <el-dropdown-item>退出</el-dropdown-item>
                        </div>
                    </el-dropdown-menu>
                </template>
            </el-dropdown>
        </div>
    </div>
</template>
    
<script setup lang='ts'>
import Cookies from 'js-cookie';
import { useRouter } from 'vue-router';

const router = useRouter()

const gohome = () => {
    router.push('/')
}

function tuichu() {
    Cookies.remove('token')
    router.push('/login')
}
</script>
    
<style lang="less">
.header-nav {
    padding: 0 20px;
    height: 70px;
    color: #fff;
    background-color: #409eff;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .left {
        .text {
            font-size: 22px;
            margin-right: 15px;
        }

        .el-icon-menu {
            font-size: 20px;
        }
    }

    .right {
        .el-dropdown-link {
            color: #fff;
            cursor: pointer;
        }

    }
}
</style>